<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
include("database/DataProvider.php");
$username=$_POST['username'];
$password=$_POST['password'];

$query="select * from taikhoan where TenDangNhap='".$username."' AND MatKhau='".$password."'";
$result = DataProvider::ExecuteQuery($query);

$count=mysql_num_rows($result);
if($count == 0)
{
	session_start();
	echo "Pls check again your username or password <br />";
	include("login_form.php");
}
else
{	
	session_start();
	while($row = mysql_fetch_array($result))
	{	
		$_SESSION['fullname'] = $row["TenHienThi"];
		$_SESSION['username'] = $row["TenDangNhap"];
		$_SESSION['userid'] = $row["MaTaiKhoan"];
		echo $_SESSION['fullname'];
		header("Location: index.php");
	}
}
?>
</body>
</html>
